package common;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.Calendar;

import common.rmi.event.RemoteEvent;


public abstract class Event extends UnicastRemoteObject implements RemoteEvent{
	private static final long serialVersionUID = 1L;
	
	protected  String id;
	private static long serial=0;
	protected String type;
	protected long timestamp;
	
	protected Event(String type) throws RemoteException{
		super(0);
		this.id=issueID();
		this.type=type;
		this.timestamp=Calendar.getInstance().getTimeInMillis();	
	}
	
	private static String issueID(){
		serial++;
		return String.valueOf(serial);
	}
	
	public String getType() throws RemoteException{
		return type;
	}
	
	public long getTimestamp() throws RemoteException{
		return timestamp;
	}
	
	@Override
	public String stringRep() throws RemoteException {
		return null;
	}
	

	
}
